import Vue from 'vue'
import store from '@/store/index'
/**权限指令**/
export default Vue.directive('perm', {
    bind: function (el, binding, vnode) {
        let curPerm = binding.value;// dom上绑定的值
        let prems = store.getters.prems;// 该角色所有权限
        if(!Vue.prototype.$_perm(curPerm,prems)) {
            el.style.setProperty('display', 'none', 'important');
        }
    }
});
// 权限检查方法
Vue.prototype.$_perm = function (curPerm,prems) {
   return prems.includes(curPerm);
};